<!-- NewPracticeHomePage_frame.html -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>实习首页frame</title>
    <link rel="stylesheet" href="../../css/api.css" />
	<link rel="stylesheet" href="../../css/mui.min.css"/>
	<link rel="stylesheet" href="../../css/base.css"/>
	<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
	<link rel="stylesheet" href="../../css/newPractice.css">
	<style type="text/css">
		.practice-tab .practice-tab-subview{
			text-align: center;
			height: 80px;
		}
		.practice-tab-box .practice-tab {
		    padding-top: 0;
		}
		.practice-tab-div{
			padding-bottom: 0;
		}
		.nav-img{
			width: 50px;
			height: 50px;
			display: inline;
		}
		.nav-p{
			font-size: 14px;
			line-height: 14px;
			margin: 0;
		}
		.switch-tab{
			padding-bottom: 6px;
			margin-right: 10px;
		}
		.switch-active{
			border-bottom: 2px solid #f16b6f;
		}
		/*弹框*/
		.kkpop{
			background: #fff;
			overflow: hidden;
			border-radius: 0.2rem;
		}
		.kkiconbox{
			padding-top: 0.8rem;
			text-align: center;
			overflow: hidden;
			padding-bottom: 0.15rem;
		}
		.kkiconbox img{
			display: block;
			margin: 0 auto;
			height: 4.2rem;
		}
		.kktips{
			font-size: 0.4rem;
			color: #666;
			text-align: center;
			margin-bottom: 0.4rem;
		}
		.kktips p{
			font-size: 0.4rem;
		}
		.kktips .tips-txt{
			font-size: 0.6rem;
			line-height: 1.1rem;
			text-align: center;
			color: #333;
			padding: 0 0.35rem;
		}
		.kktips .tips-color1{
			color: #66bde6;
		}
		.kktips .tips-color2{
			color: #f16b6f;
			font-size: 1.2rem;
		}
		.kkbtnbox{
			line-height: 1.26rem;
			border-top: 0.04rem solid #e0e0e0;
			text-align: center;
			font-size: 0.48rem;
		}
		.kkbtnbox span.queren{
			color: #66bde6;
			display: inline-block;
			height: 100%;
			width: 100%;
		}
		.kklayer{
			border-radius: 0.2rem;
			overflow: hidden;
		}
		.layui-layer {
			background-color: rgba(0,0,0,0);
		}
		.layui-layer-content{
			background-color: rgba(0,0,0,0);
		}
		.plan-name-div{
			padding: 5px 10px;
			padding-bottom: 0;
			background-color: white;
			position: relative;
		}
		.plan-name-div:before{
			content: '';
			position: absolute;
			left: 0;
			width: 200%;
			height: 200%;
			border-bottom: 1px solid #dfdfdf;
			-webkit-transform-origin: 0 0;
			-moz-transform-origin: 0 0;
			-ms-transform-origin: 0 0;
			-o-transform-origin: 0 0;
			transform-origin: 0 0;
			-webkit-transform: scale(0.5, 0.5);
			-ms-transform: scale(0.5, 0.5);
			-o-transform: scale(0.5, 0.5);
			transform: scale(0.5, 0.5);
			-webkit-box-sizing: border-box;
			-moz-box-sizing: border-box;
			box-sizing: border-box;
		}
		.plan-name-p{
			text-align: center;
			font-size: 14px;
			line-height: 20px;
			color: #999;
			margin: 0;
		}
		.top-prompt{
			position: fixed;
			left: 0;
			top: -40px;
			height: 40px;
			width: 100%;
			text-align: center;
			background-color: rgba(220, 120, 20, 0.8);
			font-size: 16px;
			color: white;
			z-index: 999;
		}
		#top_prompt{
			color: white;
			line-height: 40px;
			font-size: 16px;
			margin: 0;
		}
	</style>
</head>
<body>
	<div id="top_prompt_div" class="top-prompt">
		<p id="top_prompt">
			欢迎您进入“长风精细化实习实践服务体系”
		</p>
	</div>
	<div name="conten_div">
		<!-- 轮播图 -->
		<div id="train_slider" class="mui-slider rotation-div" >
			<div id="rotation" class="mui-slider-group mui-slider-loop">
				<!-- <div class="mui-slider-item mui-slider-item-duplicate">
					<a href="#">
						<img class="rotation-img" src="../../image/course_placehoder.png">
					</a>
				</div>
				<div class="mui-slider-item">
					<a href="#">
						<img class="rotation-img" src="../../image/course_placehoder.png">
					</a>
				</div>
				<div class="mui-slider-item mui-slider-item-duplicate">
					<a href="#">
						<img class="rotation-img" src="../../image/course_placehoder.png">
					</a>
				</div> -->
			</div>
			<div id="noRotation" hidden="hidden">
				<div class="rotation-cell">
					<!-- <a href="#"> -->
						<img class="rotation-img" style="display: block;" src="../../image/firstNewsTitls2.png">
					<!-- </a> -->
				</div>
			</div>
			<div id="pageControl" class="mui-slider-indicator">
				<!-- <div class="mui-indicator mui-active"></div> -->
			</div> 
		</div>
		<div class="plan-name-div">
			<p id="plan_name" class="plan-name-p">
				实习计划名称
			</p>
		</div>
		<div class="hot-news-title">
			<img src="../../image/icon_01.png" alt="" class="hot-news-title-img">
			<span class="base_dark_grey_shallow base_content_font hot-news-title-span">
				轮岗岗位
			</span>
		</div>
		<div class="train-div mui-table-view">
			<div id="post_tableview" class="lungang-content-div">
				<!-- <div class="lungang-left-div">
					<div class="lungang-sub-div">
						<div class="lungang-sub-content-div lungang-status-1">
							<p class="gangweimingcheng-p">
								仓储管理员
							</p>
							<p class="gangwei-status-p">
								进行中
							</p>
							<div class="lungang-status-box">
								<span class="lungang-status-title">
									进行中
								</span>
							</div>
						</div>
					</div>
				</div>
				<div class="lungang-left-div">
					<div class="lungang-sub-div">
						<div class="lungang-sub-content-div lungang-status-0">
							<p class="gangweimingcheng-p">
								运输规划
							</p>
							<p class="gangwei-status-p">
								未进行
							</p>
							<div class="lungang-status-box">
								<span class="lungang-status-title">
									未进行
								</span>
							</div>
						</div>
					</div>
				</div>
				<div class="lungang-left-div">
					<div class="lungang-sub-div">
						<div class="lungang-sub-content-div lungang-status-2">
							<p class="gangweimingcheng-p">
								客服
							</p>
							<p class="gangwei-status-p">
								已通过
							</p>
							<div class="lungang-status-box">
								<span class="lungang-status-title">
									已通过
								</span>
							</div>
						</div>
					</div>
				</div>
				<div class="lungang-left-div">
					<div class="lungang-sub-div">
						<div class="lungang-sub-content-div lungang-status-3">
							<p class="gangweimingcheng-p">
								快递配送
							</p>
							<p class="gangwei-status-p">
								未通过
							</p>
							<div class="lungang-status-box">
								<span class="lungang-status-title">
									未通过
								</span>
							</div>
						</div>
					</div>
				</div> -->
			</div>
		</div>
		<div class="hot-news-title">
			<img src="../../image/icon_04.png" alt="" class="hot-news-title-img">
			<span class="base_dark_grey_shallow base_content_font hot-news-title-span">
				实习周期
			</span>
		</div>
		<div class="mui-table-view">
			<div class="time-title-div">
				<div class="left-div">
					<p class="time-title-p">
						开始日期：<span id="start_time">----.--.--</span>
					</p>
				</div>
				<div class="right-div">
					<p class="time-title-p">
						结束日期：<span id="end_time">----.--.--</span>
					</p>
				</div>
			</div>
		</div>
		<div class="train-div mui-table-view">
			<div class="practice-tab-div">
				<div id="qiandao" class="practice-tab-box">
					<div class="practice-tab">
						<div class="practice-tab-subview">
							<!-- <button type="button" class="mui-btn mui-btn-block tab-btn">签到</button> -->
							<img src="../../image/icon_qiandao.png" class="nav-img">
							<p class="nav-p">
								签到
							</p>
						</div>
					</div>
				</div>
				<div id="baogao" class="practice-tab-box">
					<div class="practice-tab">
						<div class="practice-tab-subview">
							<!-- <button type="button" class="mui-btn mui-btn-block tab-btn">报告</button> -->
							<img src="../../image/icon05.png" class="nav-img">
							<p class="nav-p">
								报告
							</p>
						</div>
					</div>
				</div>
				<div id="kaohe" class="practice-tab-box">
					<div class="practice-tab">
						<div class="practice-tab-subview">
							<!-- <button type="button" class="mui-btn mui-btn-block tab-btn">考核</button> -->
							<img src="../../image/icon_test.png" class="nav-img">
							<p class="nav-p">
								考核
							</p>
						</div>
					</div>
				</div>
				<div id="xuexi" class="practice-tab-box">
					<div class="practice-tab">
						<div class="practice-tab-subview">
							<!-- <button type="button" class="mui-btn mui-btn-block tab-btn">学习</button> -->
							<img src="../../image/icon_xuexi.png" class="nav-img">
							<p class="nav-p">
								学习
							</p>
						</div>
					</div>
				</div>
				<div id="guiji" class="practice-tab-box">
					<div class="practice-tab">
						<div class="practice-tab-subview">
							<!-- <button type="button" class="mui-btn mui-btn-block tab-btn">轨迹</button> -->
							<img src="../../image/icon_guiji.png" class="nav-img">
							<p class="nav-p">
								轨迹
							</p>
						</div>
					</div>
				</div>
				<div id="fankui" class="practice-tab-box">
					<div class="practice-tab">
						<div class="practice-tab-subview">
							<!-- <button type="button" class="mui-btn mui-btn-block tab-btn">反馈</button> -->
							<img src="../../image/icon_nav06.png" class="nav-img">
							<p class="nav-p">
								反馈
							</p>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="hot-news-title">
			<img src="../../image/icon_05.png" alt="" class="hot-news-title-img">
			<span id="course" class="base_dark_grey_shallow base_content_font hot-news-title-span switch-tab switch-active">
				推荐课程
			</span>
			<span id="test" class="base_dark_grey_shallow base_content_font hot-news-title-span switch-tab">
				评测
			</span>
			<span id="more_train" onclick="moreDongTai()" class="train-more base_grey base_tag_font" style="display:none;">
				更多 &#62
			</span>
		</div>
		<div class="train-div mui-table-view">
			<ul id="course_list" class="mui-table-view">
				<!-- <li class="mui-table-view-cell mui-media">
					<a href="javascript:;"> 
						<img class="mui-media-object mui-pull-left course-img" src="../../image/list-default.png"/>
						<div class="mui-media-body top-content">
							<p class="course_title">推荐课程</p>
							<span class="right-time-title">
								2019.01.01
							</span>
						</div>
						<div class="mui-media-body bottom-content">
							<div class="">
								<p class="mui-ellipsis subtitle">
									课程课程课程课程课程课程课程课程
								</p>
							</div>
						</div>
					</a>
				</li> -->
				<div class="noSign" hidden="hidden" id="noData1">
					<img src="../../image/icon_img.png" width="60%">
					<p class="font16 top_15 base_dark_grey" >
						暂无数据
					</p>
				</div>
				<div class="loadFailure" hidden="hidden" id="noNet1">
					<img src="../../image/icon_img01.png" width="60%">
					<p class="" >
						数据加载失败
					</p>
					<p>
						请检查您的网络
					</p>
					<button type="button" class="mui-btn mui-btn-outlined" onclick="loadCourseData()">
						重新加载
					</button>
				</div>
			</ul>
			<ul id="test_list" class="mui-table-view" style="display: none;">
				<!-- <li class="mui-table-view-cell mui-media">
					<a href="javascript:;"> 
						<img class="mui-media-object mui-pull-left course-img" src="../../image/list-default.png"/>
						<div class="mui-media-body top-content">
							<p class="course_title">我的评测</p>
							<span class="right-time-title">
								2019.01.01
							</span>
						</div>
						<div class="mui-media-body bottom-content">
							<div class="">
								<p class="mui-ellipsis subtitle">
									评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情评测详情
								</p>
							</div>
						</div>
					</a>
				</li> -->
				<div class="noSign" hidden="hidden" id="noData2">
					<img src="../../image/icon_img.png" width="60%">
					<p class="font16 top_15 base_dark_grey" >
						暂无数据
					</p>
				</div>
				<div class="loadFailure" hidden="hidden" id="noNet2">
					<img src="../../image/icon_img01.png" width="60%">
					<p class="" >
						数据加载失败
					</p>
					<p>
						请检查您的网络
					</p>
					<button type="button" class="mui-btn mui-btn-outlined" onclick="loadTestData()">
						重新加载
					</button>
				</div>
			</ul>
		</div>
	</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/mui.min.js"></script>
<script type="text/javascript" src="../../script/MD5.js"></script>
<script type="text/javascript" src="../../script/requestTool.js"></script>
<script type="text/javascript" src="../../script/timeStampTool.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/v3.1.1/layer.js"></script>
<script type="text/javascript" src="../../script/newresize.js"></script>
<script type="text/javascript" src="../../script/permission.js"></script>
<script type="text/javascript">
	mui.init({});
</script>
<script type="text/javascript">
	var rotationArr = new Array();//轮播图数据
	var page = 1;
	var rows = 10;
	var dropRefreshCount = 0;
	var currentType = 0;
	var uid;
    var jid;
	var currentPractice = null;//当前实习计划数据
	var postArr = null;
	var courseArr = new Array();
	var testArr = new Array();
	var loadDataStatus = 0;
    $(document).ready(function(){
    	$('.switch-tab').click(function(){
    		var isActive = $(this).hasClass('switch-active');
    		if (isActive == false) {//未选中
    			$('.switch-tab').removeClass('switch-active');
    			$(this).addClass('switch-active');
    			if ($(this).attr('id') == 'course') {
    				currentType = 0;
    				$('#course_list').show();
					$('#test_list').hide();
    			}else{
    				currentType = 1;
    				$('#course_list').hide();
    				$('#test_list').show();
    			}
    		}
    	});
    });
	apiready = function(){
		prepareData();
		setupTagClick();
		loadData();
		setPullUpRefresh();
		setupPrompt();
	}
	//设置提示框
	function setupPrompt(){
		$("#top_prompt_div").animate({
			top: "0"},
			1000, function() {
			setTimeout(function(){
				$("#top_prompt_div").animate({
					top: "-40px"},
					1000);
			}, 2000);
		});
	}
	function setupLoadDataStatus(){
		loadDataStatus++;
		if (loadDataStatus == 4) {
			api.hideProgress();
		}
	}
	function setupTagClick(){
		$('#qiandao').click(function(){
			checkPermission(['location'],function (ret) {
				if(ret){
					api.openWin({useWKWebView:true,
						name : 'Student_dailyCheckWindow',
						url : '../TrainReport/Student_dailyCheckWindow.html'
					});
				}else {
					api.alert({
						title: '警告',
						msg: '未获取到定位权限，签到功能无法使用，请到系统设置中打开定位权限'
					}, function(ret, err) {

					});
				}
			})

		});
		$('#baogao').click(function(){
			api.openWin({useWKWebView:true,
				name : 'Practice_StudentReport_Win',
				url : '../Practice_Student/Practice_StudentReport_Win.html'
			});
		});
		$('#kaohe').click(function(){
			api.openWin({useWKWebView:true,
				name : 'Practice_StudentExamWindow',
				url : '../Practice_Student/Practice_StudentExamWindow.html',
				pageParam : {
					openType : 'train_stu'
				}
			});
		});
		$('#xuexi').click(function(){
			api.openWin({useWKWebView:true,
				name : 'Student_studyWindow',
				url : '../Study/Student_studyWindow.html',
				pageParam : {
					openType : 'train_stu'
		     	}
			});
		});
		$('#guiji').click(function(){
			api.openWin({useWKWebView:true,
				name : 'PositionDetailsViewWind',
				url : '../Practice_Student/PositionDetailsViewWind.html',
				pageParam : {
	 				uid : $api.getStorage('cfnetppuid')
				}
			});
		});
		$('#fankui').click(function(){
			api.openWin({useWKWebView:true,
				name : 'suggestBack',
				url : '../Practice_Mine/suggestBack.html',
				slidBackEnabled : false,
				pageParam : {
					type : 1
				}
			});
		});
	}
	function prepareData(){
        uid = $api.getStorage('cfnetppuid');
        jid = $api.getStorage('cfnetppjid');
    }
	function loadData(){
		api.showProgress({
		    style: 'default',
		    animationType: 'fade',
		    title: '数据加载中...',
		    text: '',
		    modal: false
		});
		loadRotationData();
		loadPracticeData();
		loadCourseData();
		loadTestData();
	}
	// 上拉加载
	function setPullUpRefresh() {
		api.addEventListener({
			name : 'scrolltobottom'
		}, function(ret, err) {
			if (currentType == 0) {//课程
				if (dropRefreshCount >= rows) {
					dropRefreshCount = 0;//防止跳页刷新
					page++;
					loadCourseData();
				}
			}
		});
	}
	function loadTestData(){
		var params = {
			uid : uid,
			jid : jid,
			usertype : 0
		};
		cfnetppPOST(url_trainIndex, params, true, function(data, status){
			setupLoadDataStatus();
			if (status == 'success') {
				if (data.code == 200) {
					var jsonData = data.data;
					var zixun = jsonData.zixun;
					if (zixun != undefined && zixun != null && zixun.constructor == Array && zixun.length > 0) {
						testArr = zixun;
						setupTestData();
					}else{
						$('#noData2').show();
						$('#noNet2').hide();
					}
				}else{
					$('#noData2').show();
					$('#noNet2').hide();
				}
			}else{
				$('#noData2').hide();
				$('#noNet2').show();
			}
		});
	}
	function setupTestData(){
		for (var i = 0; i < testArr.length; i++) {
			var testData = testArr[i];
			$('#test_list').append(testCellHtml(i, testData));
		}
		setupTestClick();
	}
	function setupTestClick(){
		$('.test-cell').unbind('click');
		$('.test-cell').click(function(){
			var index = $(this).attr('index');
			var testData = testArr[parseInt(index)];
			var type = testData.type;
			var istype = testData.istype;
			var url = testData.url;
			testPushWithType(type, istype, url);
		});
	}
	//测评
	function testPushWithType(type, istype, url) {
		var winName = "";
		var winUrl = "";
		if (istype == 0) {//没考
			if (type == 4) {
				winName = "Practice_Holland_EvaluationAnalysis"
				winUrl = "../TrainReport/Practice_Holland_EvaluationAnalysis.html"
			} else {
				winName = "Practice_EvaluationAnalysis"
				winUrl = "./.TrainReport/Practice_EvaluationAnalysis.html"
			}
		} else {
			if (type == 4) {
				winName = "HolandeAnalysis_window"
				winUrl = "../Holander/HolandeAnalysis_window.html"
			} else {
				winName = "Practice_EvaluationAnalysisScore";
				winUrl = "../TrainReport/Practice_EvaluationAnalysisScore.html";
			}
		}
		params = {
			type : type,
			istype : istype, //0:未参加 1:参加
			sourceurl : window.location.pathname,
			sourcetitle : document.title
		};
		if (type == 5) {
			winName = 'QRCode_Win';
			winUrl = '../HomePage/QRCode_Win.html'
			params['url'] = url;
		}
		api.openWin({useWKWebView:true,
			name : winName,
			url : winUrl,
			pageParam : params
		});
	}
	function testCellHtml(index, data){
		var title = escape2Html(data.title).replace(/&/g, '');
		var desc = data.desc;
		var img = data.img;
		return '<li index="'+index+'" class="test-cell mui-table-view-cell mui-media">'+
					'<a href="javascript:;">'+
						'<img class="mui-media-object mui-pull-left course-img" src="'+img+'"/>'+
						'<div class="mui-media-body top-content">'+
							'<p class="course_title">'+title+'</p>'+
							'<span class="right-time-title">'+
							'</span>'+
						'</div>'+
						'<div class="mui-media-body bottom-content">'+
							'<div class="">'+
								'<p class="mui-ellipsis subtitle">'+
									desc+
								'</p>'+
							'</div>'+
						'</div>'+
					'</a>'+
				'</li>';
	}
	//加载轮播图数据
	function loadRotationData() {
		var params = {};
		// alert('url:'+url_trainRotation+'\n'+JSON.stringify(params));
		cfnetppPOST(url_newPracticeRotation, params, true, function(data, status){
			setupLoadDataStatus();
			if (status == "success") {
				if (data.status == true) {
					var news = data.data.news;
					if (news != undefined && news != null && news.constructor == Array && news.length > 0) {
						rotationArr = news;
						setupRotationData();
					}
				}
			}
		});
	}
	//加载推荐课程列表
	function loadCourseData(){
		var params = {
			page : page,
			rows : rows
		};
		cfnetppPOST(url_newPracticeRecommendCourse, params, true, function(data, status){
			setupLoadDataStatus();
			if (status == "success") {
				if (data.status == true) {
					var jsonData = data.data;
					if (jsonData != undefined && jsonData != null && jsonData.constructor == Array && jsonData.length > 0) {
						if (page == 1) {
							$('#course_list').html('');
						}
						var oldCount = courseArr.length;
						courseArr = courseArr.concat(jsonData);
						var newCount = courseArr.length;
						for (var i = oldCount; i < newCount; i++) {
							var courseData = courseArr[i];
							$('#course_list').append(courseCellHtml(i, courseData));
						}
						setupCourseCellClick();
					}else{
						if (page == 1) {
							$('#noData1').show();
							$('#noNet1').hide();
						}
					}
				}else{
					if (page == 1) {
						$('#noData1').show();
						$('#noNet1').hide();
					}
				}
			}else{
				if (page == 1) {
					$('#noData1').hide();
					$('#noNet1').show();
				}
			}
		});
	}
	function setupCourseCellClick(){
		$('.course-cell').unbind('click');
		$('.course-cell').click(function(){
			var index = $(this).attr('index');
			var courseData = courseArr[parseInt(index)];
			var course_type = courseData.course_type;
			if (course_type == '2109') {//mooc
				openMoocCourse(courseData);
			}
			// else if(course_type == '2108'){//自由课程
			// 	openFreeCourse(courseData);
			// }
			else{
				api.toast({
				    msg: '暂不支持该课程类型'
				});
			}
		});
	}
	function openFreeCourse(data){
		api.openWin({useWKWebView:true,
			name : 'Student_trainFreeCourseTab',
			url : '../Study/Student_trainFreeCourseTab.html',
			bgColor : '#fff',
			vScrollBarEnabled : false,
			hScrollBarEnabled : false,
			pageParam : {
				imgurl : data.course_image,//课程图片
				title : data.course_name,//课程名称
				planid : '',//计划id
				courseid : data.course_id,//课程id
				cstatus : '',//0 
				selected : 1,//1
				part : '',//集团id
				crid : '',//可无
				examid : '',//考试id
				coursename : data.course_name,//课程名称
				userType : 'student',//用户类型
				coverimages : data.course_image,//课程图片
				sourceurl : window.location.pathname,
			    sourcetitle : document.title
			}
		});
	}
	function openMoocCourse(data){
		var param = {
			imgurl : data.course_image,
			title : data.course_name,
			courseType : '2109',
			planid : '',
			courseid : data.course_id,
			cstatus : '',
			selected :'1',
			part : '',
			crid : '',
			userType :'student',
			coursename : data.course_name,
			coverimages : data.course_image,
			isCompetitiveProducts :1,
			opentype:'courseCenter',
			sourceurl : window.location.pathname,
            sourcetitle : document.title,
            openType : 'train_stu'
		};
      	api.openWin({useWKWebView:true,
			name: 'Student_trainCourseMoocTab',
			url: '../Study/Student_trainCourseMoocTab.html',
			bgColor : '#fff',
			vScrollBarEnabled : false,
			hScrollBarEnabled : false,
			pageParam :param
		});
	}
	function courseCellHtml(index, courseData){
		var course_image = courseData.course_image;
		if (course_image == null || course_image == '') {
			course_image = '../../image/list-default.png';
		}
		var course_name = courseData.course_name;
		var course_info = courseData.course_info;
		var speaker = courseData.speaker;
		return '<li index="'+index+'" class="course-cell mui-table-view-cell mui-media">'+
					'<a href="javascript:;">'+
						'<img class="mui-media-object mui-pull-left course-img" src="'+course_image+'"/>'+
						'<div class="mui-media-body top-content">'+
							'<p class="course_title">'+course_name+'</p>'+
							'<span class="right-time-title">'+
								speaker+
							'</span>'+
						'</div>'+
						'<div class="mui-media-body bottom-content">'+
							'<div class="">'+
								'<p class="mui-ellipsis subtitle">'+
									course_info+
								'</p>'+
							'</div>'+
						'</div>'+
					'</a>'+
				'</li>';
	}
	//加载首页当前实习数据
	function loadPracticeData(){
		var params = {
			uid : uid,
			jid : jid
		};
		cfnetppPOST(url_newPracticeDetail, params, true, function(data, status){
			setupLoadDataStatus();
			if (status == 'success') {
				if (data.code == 200) {
					var jsonData = data.data;
					if (jsonData != undefined && jsonData != null && jsonData != "" && jsonData.constructor == Array && jsonData.length > 0) {
						currentPractice = jsonData[0];
						setupPracticeData();
					}else{
						api.toast({
						    msg: '暂无实习计划，请联系管理员分配'
						});
					}
				}
			}
		});
	}
	function setupPracticeData(){
		var planname = currentPractice.planname;
		$('#plan_name').text(planname);
		var starttime = currentPractice.starttime;
		$('#start_time').text(timePointStringWithTimeStamp(starttime));
		var endtime = currentPractice.endtime;
		$('#end_time').text(timePointStringWithTimeStamp(endtime));
		var post_list = currentPractice.post_list;
		if (post_list != undefined && post_list != null && post_list != "" && post_list.constructor == Array && post_list.length > 0) {
			postArr = post_list;
			setupPostList();
		}
	}
	function setupPostList(){
		for (var i = 0; i < postArr.length; i++) {
			var postData = postArr[i];
			setupCurrentPost(postData);
			if (postData.status == 1) {//进行中的岗位
				remindExamMessage(postData);
			}
			$('#post_tableview').append(postCellHtml(i, postData));
		}
		setupPostCellClick();
	}
	function setupPostconfirm(postData){
		applysuccess(postData);
		var practicestatus_id = postData.practicestatus_id;
		var params = {
			uid : $api.getStorage('cfnetppuid'),
			jid : $api.getStorage('cfnetppjid'),
			practicestatus_id : practicestatus_id
		};
		cfnetppPOST(url_newPracticePostConfirm, params, false, function(data, status){});
	}
	function setupCurrentPost(postData){
		var apply_status = postData.apply_status;
		var confirm_status = postData.confirm_status;
		if (apply_status == 1 && confirm_status == 0) {
			setupPostconfirm(postData);
			// var practicestatus_id = postData.practicestatus_id;
			// var local_p_id = 'practicestatus_id_' + practicestatus_id;
			// var localStatus = $api.getStorage(local_p_id);
			// if (localStatus == undefined || localStatus == null || localStatus == '') {
			// 	$api.setStorage(local_p_id, '1');
			// 	setupPostconfirm(postData);
			// }
		}
	}
	function setupPostCellClick(){
		$('.post-cell').unbind('click');
		$('.post-cell').click(function(){
			var index = $(this).attr('index');
			var postData = postArr[parseInt(index)];
			api.openWin({useWKWebView:true,
			    name: 'NewPracticeApplyChangePost_win',
			    url: 'NewPracticeApplyChangePost_win.html',
			    pageParam: {
			    	postArr : postArr,
			    	postData : postData
			    }
			});
		});
	}
	function postCellHtml(index, data){
		var status = data.status;
		var tag = '';
		switch(status){
			case 0:
			tag = '未开始';
			break;
			case 1:
			tag = '进行中';
			break;
			case 2:
			tag = '已通过';
			break;
			case 3:
			tag = '未通过';
			break;
		}
		return '<div index="'+index+'" class="post-cell lungang-left-div">'+
					'<div class="lungang-sub-div">'+
						'<div class="lungang-sub-content-div lungang-status-'+status+'">'+
							'<p class="gangweimingcheng-p">'+
								data.post_name+
							'</p>'+
							'<p class="gangwei-status-p">'+
								tag+
							'</p>'+
							'<div class="lungang-status-box">'+
								'<span class="lungang-status-title">'+
									tag+
								'</span>'+
							'</div>'+
						'</div>'+
					'</div>'+
				'</div>';
	}
	//设置轮播图数据
	function setupRotationData(){
		if (rotationArr.length == 1) {
			var rotationHtml = '';
			rotationHtml = noRotationHtmlString(0, rotationArr[0]);
			$('#noRotation').html(rotationHtml);
			$('#noRotation').show();
			$('#rotation').hide();
		}else{
			var rotationHtml = '';
			//额外增加的一个节点(循环轮播：第一个节点是最后一张轮播)
			var lastIndex = rotationArr.length - 1;
			var rotationLastData = rotationArr[lastIndex];
			rotationHtml += firstLastImgHtml(lastIndex, rotationLastData);
			//遍历数组
			for (var i = 0; i < rotationArr.length; i++) {
				var rotationData = rotationArr[i];
				rotationHtml += rotationHtmlString(i, rotationData);
			}
			//额外增加的一个节点(循环轮播：最后一个节点是第一张轮播)
			var firstIndex = 0;
			var rotationFirstData = rotationArr[firstIndex];
			rotationHtml += firstLastImgHtml(firstIndex, rotationFirstData);
			//设置轮播图代码
			$('#rotation').html(rotationHtml);
			//设置page Control
			$('#pageControl').html(pageControlHtml(rotationArr.length));
			//设置自动轮播
			setupAutoRotation();
			$('#noRotation').hide();
			$('#rotation').show();
		}
		//设置轮播图点击事件
		setupRotationCellClick();
	}
	function setupRotationCellClick(){
		$('.rotation-cell').unbind('click');
		$('.rotation-cell').click(function(event) {
			if (api.connectionType == "none") {
				api.toast({
				    msg: '网络异常，请检查网络！'
				});
				return;
			}
			var index = $(this).attr('index');
			var rotationData = rotationArr[parseInt(index)];
			if (rotationData.detail != null && rotationData.detail != '') {
				api.openWin({useWKWebView:true,
				    name: 'Teacher_TrainNewsDetail',
				    url: '../Teacher_Teach/Teacher_TrainNewsDetail.html',
				    pageParam: rotationData
				});
			}
		});
	}
	//分页html
	function pageControlHtml(count){
		var pageControl = '';
		pageControl += '<div class="mui-indicator mui-active"></div>';
		for (var i = 1; i < count; i++) {
			pageControl += '<div class="mui-indicator"></div>';
		}
		return pageControl;
	}
	//轮播图首尾
	function firstLastImgHtml(index, data){
		return '<div index="'+index+'" class="rotation-cell mui-slider-item mui-slider-item-duplicate">'+
					'<a href="#">'+
						'<img class="rotation-img" src="'+data.image+'">'+
					'</a>'+
				'</div>';
	}
	//轮播图
	function rotationHtmlString(index, data){
		return '<div index="'+index+'" class="rotation-cell mui-slider-item">'+
					'<a href="#">'+
						'<img class="rotation-img" src="'+data.image+'">'+
					'</a>'+
				'</div>';
	}
	//不轮播的cell
	function noRotationHtmlString(index, data){
		return '<div index="'+index+'" class="rotation-cell">'+
					'<img class="rotation-img" style="display: block;" src="'+data.image+'">'+
				'</div>';
	}
	function setupAutoRotation(){
		var slider = mui("#train_slider");
		slider.slider({
			interval: 3000
		});
	}
	//申请成功
	function applysuccess(postData){
		var shtml = '<div class="kkpop">'+
						'<div class="kkiconbox">'+
							'<img src="../../image/apicon01.png"/>'+
						'</div>'+
						'<div class="kktips">'+
							'<p><span class="tips-txt tips-color1">恭喜您！</span></p>'+
							'<p>申请<span class="tips-txt">'+postData.post_name+'</span>成功</p>'+
						'</div>'+
						'<div class="kkbtnbox">'+
							'<span class="queren">确认</span>'+
						'</div>'+
					'</div>';
		layer.open({
			type:1,
			title:false,
			closeBtn:0,
			area:['90%','auto'],
			skin:'kklayer',
			content:shtml,
			success:function(layero, index){
				$(".kkbtnbox .queren").on("click",function(){
					layer.close(index);
				})
			}
		})
	}
	//加载考核数据
	function loadExamData(postData, callback){
		var params = {
			uid : uid,
			jid : jid,
			gwid : postData.post_id
		};
		cfnetppPOST(url_getExamStudentList, params, true, function(data, status){
			if (status == 'success') {
				if (data.code == 200) {
					var examArr = data.data;
					if (examArr != undefined && examArr != null && examArr.constructor == Array && examArr.length > 0) {
						if (callback != null) {
							callback(postData, examArr);
						}
					}
				}
			}
		});
	}
	//提醒考核消息
	function remindExamMessage(postData){
		var remindTimeTag = 'remindTime_' + postData.post_id;
		var remindTime = $api.getStorage(remindTimeTag);
		var todyTimeString = timeStringWithTimeStamp(new Date());
		if (remindTime != undefined && remindTime != null && remindTime != '') {
			if (todyTimeString > remindTime) {//即今日未提醒
				$api.setStorage(remindTimeTag, todyTimeString);
				setupExamData(postData);
			}
		}else{
			$api.setStorage(remindTimeTag, todyTimeString);
			setupExamData(postData);
		}
	}
	//根据考核数据提醒
	function setupExamData(postData){
		loadExamData(postData, function(postData2, examArr){
			var p_starttime = parseInt(postData2.starttime);
			var p_endtime = parseInt(postData2.endtime);
			var now_time = timeStamp10(new Date());
			//判断是否与当前时间冲突
			if (now_time < p_starttime || now_time > p_endtime) {
				return;
			}
			//是否有未考核
			var isExamined = true;
			//遍历考核数组
			for (var i = 0; i < examArr.length; i++) {
				var examData = examArr[i];
				var e_starttime = parseInt(examData.starttime);
				var e_endtime = parseInt(examData.endtime);
				var exam_status = examData.exam_status;
				//是否为考核，时间上是否在岗位时间范围内
				if (exam_status == -1 && e_starttime >= p_starttime && e_endtime <= p_endtime) {
					isExamined = false;
				}
			}
			//如果有则提醒
			if (isExamined == false) {
				testfail(postData2);
			}
		});
	}
	//考核未通过
	function testfail(data){
		var shtml = '<div class="kkpop">'+
						'<div class="kkiconbox">'+
							'<img src="../../image/apicon02.png"/>'+
						'</div>'+
						'<div class="kktips">'+
							'<p>岗位<span class="tips-txt">'+data.post_name+'</span>还有未通过的考核</p>'+
							// '<p>剩余<span class="tips-txt tips-color2">7</span>天</p>'+
							'<p>请尽快完成考核</p>'+
						'</div>'+
						'<div class="kkbtnbox">'+
							'<span class="queren">确认</span>'+
						'</div>'+
					'</div>';
		layer.open({
			type:1,
			title:false,
			closeBtn:0,
			area:['90%','auto'],
			skin:'kklayer',
			content:shtml,
			success:function(layero, index){
	//			console.log(layero);
				$(".kkbtnbox .queren").on("click",function(){
					layer.close(index);
				})
			}
		})
	}
	function practiceRemind(data){
		var shtml = '<div class="kkpop">'+
						'<div class="kkiconbox">'+
							'<img src="../../image/icon_practice_start.png"/>'+
						'</div>'+
						'<div class="kktips">'+
							'<p>岗位<span class="tips-txt">'+data.post_name+'</span>已经开始了</p>'+
							'<p>记得完成每天的任务哦</p>'+
						'</div>'+
						'<div class="kkbtnbox">'+
							'<span class="queren">确认</span>'+
						'</div>'+
					'</div>';
		layer.open({
			type:1,
			title:false,
			closeBtn:0,
			area:['90%','auto'],
			skin:'kklayer',
			content:shtml,
			success:function(layero, index){
	//			console.log(layero);
				$(".kkbtnbox .queren").on("click",function(){
					layer.close(index);
				})
			}
		})
	}
</script>
</html>